<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Node节点</title>
  <script>
    // window.onload就是页面加载完毕之后
    window.onload = function() {
      var dom = document.getElementById('first')
      console.log(dom.childNodes);
      // 类数组对象转数组
      // 1、方法一
      // var newArr = Array.prototype.slice.call(dom.childNodes,0)
      // 2、方法二 es6的数组API
      var newArr = Array.from(dom.childNodes)
      var elements = newArr.filter(function(item) {
        return item.nodeType == 3
      })
      console.log(elements);
    }
  </script>
</head>
<body>
  hello text
  <div class="box" id="first">
    <p>hello Dom</p>
    <span>行内元素</span>
    <a href="">百度一下</a>
    html
    <!-- 注释 -->
  </div>
  <!-- 注释信息 -->
</body>
</html>